using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace CoreManager.Models.Entities
{
    /// <summary>
    /// 用户实体
    /// </summary>
    [Table("sys_user")]
    public class User : BaseEntity
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [Required]
        [MaxLength(50)]
        [Column("user_name")]
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 密码
        /// </summary>
        [Required]
        [MaxLength(100)]
        [Column("password")]
        public string Password { get; set; } = string.Empty;

        /// <summary>
        /// 真实姓名
        /// </summary>
        [MaxLength(50)]
        [Column("real_name")]
        public string? RealName { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [MaxLength(100)]
        [Column("email")]
        public string? Email { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [MaxLength(20)]
        [Column("phone")]
        public string? Phone { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        [MaxLength(200)]
        [Column("avatar")]
        public string? Avatar { get; set; }

        /// <summary>
        /// 状态 0:禁用 1:启用
        /// </summary>
        [Column("status")]
        public int Status { get; set; } = 1;

        /// <summary>
        /// 最后登录时间
        /// </summary>
        [Column("last_login_time", TypeName = "datetime")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 最后登录IP
        /// </summary>
        [MaxLength(50)]
        [Column("last_login_ip")]
        public string? LastLoginIp { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(500)]
        [Column("remark")]
        public string? Remark { get; set; }
    }
}